<template>
	<navBar :title="title"></navBar>
	<view class="padding24">
		<up-parse :content="content" :domain="domain"></up-parse>
	</view>
</template>

<script setup>
	import { ref } from 'vue';
	import { domain } from '@/utils/config.js';
	import { Toast } from '@/utils/utils.js';
	import Http from '@/utils/request.js';
	import { onLoad } from '@dcloudio/uni-app';
	const content = ref('');
	const title = ref('');
	onLoad((opt) => {
		if (opt.id) getAgreement(opt.id);
	});

	const getAgreement = (id) => {
		Http.get({
			url: '/api/getAgreement',
			data: {
				id,
			},
		}).then((res) => {
			if (res.code != 0) return Toast(res.msg);
			const result = res.data || '';
			content.value = result.content;
			title.value = result.title;
		});
	};
</script>

<style lang="scss" scoped></style>
